package com.yzg.sign.project.controller;



import com.yzg.sign.project.common.Result;
import com.yzg.sign.project.domain.Upload;
import com.yzg.sign.project.service.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/api/upload")
@Api(value = "/api/upload" ,tags = {"文件上传管理"})
public class UploadController
{

    @Autowired
    private UploadService uploadService;




    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    @ApiOperation(value = "删除文件", notes = "删除文件")
     public Result<String> delete(String id)
     {
         return  uploadService.delete(id);
     }



    @RequestMapping(value = "",method = RequestMethod.POST)
    @ApiOperation(value = "上传文件", notes = "上传文件")
    public Result<Upload> upload(MultipartFile file)
    {
        return  uploadService.upload(file);
    }


    @RequestMapping(value = "/tts",method = RequestMethod.POST)
    @ApiOperation(value = "语音合成", notes = "语音合成")
    public Result<Upload> tts(String content)
    {
        return  uploadService.tts(content);
    }


}
